<%@ page language="java" import="java.util.*,ms.platform.system.model.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<title>编辑分组</title>
<base href="<%=basePath%>">
<link rel="stylesheet" type="text/css" href="<%=basePath%>js/bootstrap-3.3.6/dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/bootstrapValidator.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/mydialog.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/style.css" />
</head>
<body>
	<div id="index-hav2">
		<div class="index-hav-right" id="index-hav-right-clear">
			<div class="row">
				<div class="col-md-9">
					<span id="icon-house"> </span><span id="arrows-left">首页</span> <span
						id="arrows-left">></span><span>系统管理</span> <span id="arrows-left">></span><span>数据字典</span>
				</div>
				<div class="bank-box">
					<div class="lianlian platform">
						<div class="col-md-12" style="margin: 13px 0">
							<form id="defaultForm" class="form-horizontal" method="post" action="<%=path%>/dict/update">
							<input type="hidden" name="id" value="${dict.id }">
								<div class="panel panel-default">
									<div class="panel-body">
										<div class="form-group">
											<label class="col-sm-2 control-label">分组编码:</label>
											<div class="col-sm-6">
												<input type="text" name="dictCode" class="form-control" value="${dict.dictCode}">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label">分组名称:</label>
											<div class="col-sm-6">
												<input type="text" name="dictName" class="form-control" value="${dict.dictName}">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label">状态:</label>
											<div class="col-sm-6">
												<select class="form-control input-sm mb15" name="status">
													<option value="1"
														<c:if test="${dict.status == '1'}">selected</c:if>>禁用</option>
													<option value="0"
														<c:if test="${dict.status == '0'}">selected</c:if>>启用</option>
												</select>
											</div>
										</div>
										<div class="col-sm-8 col-btn-12">
											<button type="submit" class="btn btn-primary" id="editRoleBtn">保存</button>
											<button type="button" class="btn btn-default" onclick="window.location.href='<%=path%>/dict/list'">返回</button>
										</div>
									</div>
									
								</div>
							</form>

						</div>
					</div>

				</div>
			</div>
		</div>
	</div>
	<div id="gray-screen"></div>
</body>
<script type="text/javascript" src="<%=basePath%>js/validate/jquery-1.10.2.min.js" ></script>
<script type="text/javascript" src="<%=basePath%>js/rem.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=basePath%>js/validate/bootstrapValidator.js"></script>
<script type="text/javascript" src="<%=basePath%>js/validate/zh_CN.js"></script>
<script type="text/javascript" src="<%=basePath%>js/bootstrap-3.3.6/dist/js/bootstrap.min.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=basePath%>js/common/dialog.3.1.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {
$('#defaultForm').bootstrapValidator({
        message: 'This value is not valid',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
        	dictCode: {
                validators: {
                    notEmpty: {},
                }
            },
            dictName: {
                validators: {
                    notEmpty: {},
            		stringLength: {min: 1,max: 30},
                }
            },
         /*    is_deleted: {
                validators: {
                    notEmpty: {},
                }
            }, */
        }
    }).on('success.form.bv', function(e) {
        // Prevent form submission
        e.preventDefault();

        // Get the form instance
        var $form = $(e.target);

        // Get the BootstrapValidator instance
        var bv = $form.data('bootstrapValidator');

        // Use Ajax to submit form data
        $.post($form.attr('action'), $form.serialize(), function(result) {
        	if(result.message != undefined){
		        	Dialog({
			                "msg": '<div class="D_alert">'+result.message+'</div>',
			                "title": "提示",
			                "showButtons": true,
			                "cancelButton": false,
			                "onComplete": function() {
			                 	$("body").empty();
			                 	window.location.href="<%=path%>/dict/list";
			                }
			            });	 
        	}else{
        		window.location.href="<%=path%>/dict/list";
        	  }
        }, 'json');
    });
});

//清空搜索条件
	$(".clearForm").click(function(){
		$("#defaultForm").find("input").val("");
		var a = document.getElementById("mySelect");
		a.options[0].selected = true;
	});
</script>

</html>